package com.appwoo.txtws.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.appwoo.android.activity.BaseActivity;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.scroll.MyScrollLayout;
import com.appwoo.txtws.scroll.OnViewChangeListener;
import com.appwoo.txtws.service.RQBindInfo;
import dalvik.system.VMRuntime;

public class GuideActivity extends BaseActivity
  implements OnViewChangeListener, View.OnClickListener
{
  private static final int HEAP_SIZE = 6291456;
  private static final String PREFERENCE_NAME = "firstLogin";
  private final String PREFERENCE_LOGIN_KEY = "first";
  private SharedPreferences.Editor editor;
  private boolean fromLogin = false;
  private int mCurSel;
  private ImageView[] mImageViews;
  private MyScrollLayout mScrollLayout;
  private int mViewCount;
  private SharedPreferences sp;
  private TextView tv_guide_start;

  private void init()
  {
    this.mScrollLayout = ((MyScrollLayout)findViewById(2131493113));
    LinearLayout localLinearLayout = (LinearLayout)findViewById(2131493115);
    this.tv_guide_start = ((TextView)findViewById(2131493114));
    this.tv_guide_start.setOnClickListener(this);
    this.fromLogin = getIntent().getBooleanExtra("fromLogin", false);
    this.mViewCount = this.mScrollLayout.getChildCount();
    this.mImageViews = new ImageView[this.mViewCount];
    for (int i = 0; ; i++)
    {
      if (i >= this.mViewCount)
      {
        this.mCurSel = 0;
        this.mImageViews[this.mCurSel].setEnabled(false);
        this.mScrollLayout.SetOnViewChangeListener(this);
        this.sp = getSharedPreferences("firstLogin", 0);
        this.editor = this.sp.edit();
        this.editor.putString("first", "no");
        this.editor.commit();
        return;
      }
      this.mImageViews[i] = ((ImageView)localLinearLayout.getChildAt(i));
      this.mImageViews[i].setEnabled(true);
      this.mImageViews[i].setOnClickListener(this);
      this.mImageViews[i].setTag(Integer.valueOf(i));
    }
  }

  private void postCheckHome(int paramInt)
  {
    RqSP localRqSP = new RqSP();
    Intent localIntent = new Intent();
    if (paramInt == 1)
    {
      localRqSP.setExitVal(0, this);
      Global.isBinded = 1;
      Global.reStartWebTimeControlService(this);
      localIntent.setClass(this, GoActivity.class);
    }
    while (true)
    {
      startActivity(localIntent);
      alertMessage(getString(2131427536));
      finish();
      return;
      localIntent.setClass(this, LoginActivity.class);
    }
  }

  private void setCurPoint(int paramInt)
  {
    if ((paramInt < 0) || (paramInt > -1 + this.mViewCount) || (this.mCurSel == paramInt))
      return;
    this.mImageViews[this.mCurSel].setEnabled(true);
    this.mImageViews[paramInt].setEnabled(false);
    this.mCurSel = paramInt;
  }

  public void OnViewChange(int paramInt)
  {
    setCurPoint(paramInt);
  }

  public void onClick(View paramView)
  {
    if (paramView.getId() == 2131493114)
    {
      new LoginAsyncTask().execute(new String[] { "checkHome" });
      return;
    }
    int i = ((Integer)paramView.getTag()).intValue();
    setCurPoint(i);
    this.mScrollLayout.snapToScreen(i);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    VMRuntime.getRuntime().setMinimumHeapSize(6291456L);
    setContentView(2130903104);
    init();
  }

  public class LoginAsyncTask extends AsyncTask<String, Integer, Integer>
  {
    private String method = "";
    private ProgressDialog v_progressDialog;

    public LoginAsyncTask()
    {
    }

    protected Integer doInBackground(String[] paramArrayOfString)
    {
      this.method = paramArrayOfString[0];
      if (this.method.equals("checkHome"))
      {
        int i = new RqSP().getIsBind(GuideActivity.this);
        if (i == -1)
          i = new RQBindInfo().rqBind(GuideActivity.this);
        if (i == 1)
          return Integer.valueOf(1);
        return Integer.valueOf(0);
      }
      return Integer.valueOf(0);
    }

    protected void onPostExecute(Integer paramInteger)
    {
      if (this.method.equals("checkHome"))
        GuideActivity.this.postCheckHome(paramInteger.intValue());
      try
      {
        this.v_progressDialog.dismiss();
        return;
      }
      catch (Exception localException)
      {
      }
    }

    protected void onPreExecute()
    {
      if ((this.v_progressDialog == null) || (!this.v_progressDialog.isShowing()))
      {
        this.v_progressDialog = new ProgressDialog(GuideActivity.this);
        this.v_progressDialog.setMessage(GuideActivity.this.getString(2131427516));
        this.v_progressDialog.setCancelable(true);
      }
      try
      {
        this.v_progressDialog.show();
        return;
      }
      catch (Exception localException)
      {
      }
    }

    protected void onProgressUpdate(Integer[] paramArrayOfInteger)
    {
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.GuideActivity
 * JD-Core Version:    0.6.2
 */